﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Microsoft.Ccr.Core;
using XcoAppSpaces.Core;

namespace test.XcoAppSpaces.Core.Error_Reproductions
{
	//TODO It should somehow be possible to publish just a single port in a very simple way!!! (e.g. without needing to define a worker and contract)
	[TestFixture]
	public class testWorkerAsSinglePort
	{
		/*[Test]
		public void TestSinglePortWorker()
		{
			using (XcoAppSpace space = new XcoAppSpace())
			{
				space.RunWorker<Port<string>, SinglePortWorker<string>>();
			}
		}*/


		class SinglePortWorker<T> : Port<T>
		{
			private Handler<T> handler;

			public SinglePortWorker(Handler<T> handler)
			{
				this.handler = handler;
			}

			[XcoConcurrent]
			public void ProcessMsg(T msg)
			{
				handler(msg);
			}
		}
	}
}
